package com.zhoutao.blog.seven.model;

import com.zhoutao.blog.seven.model.enums.RefType;
import lombok.Data;

@Data
public class Ref<T> {

    private RefType refType;

    private T refId;

    public boolean hasId() {
        return this.refId != null;
    }

    public boolean hasType() {
        return this.refType != null;
    }

    public static <T> Ref<T> of(T refId, RefType type) {
        final Ref<T> ref = new Ref<>();
        return ref.setRefId(refId)
                .setRefType(type);
    }
}
